#ifndef MYOPENGLWIDGET_H
#define MYOPENGLWIDGET_H

#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
#include <QVector>
#include <QVector3D>
#include <QSet>

class QOpenGLShaderProgram;
class QOpenGLTexture;

class MyOpenGLWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
    Q_OBJECT

public:
    enum Surface{FRONT, BACK, UP, DOWN, LEFT, RIGHT};

    explicit MyOpenGLWidget(QWidget *parent = nullptr);
    ~ MyOpenGLWidget();
protected:
    void initializeGL() override;
    void paintGL() override;
    void resizeGL(int width, int height) override;
    void keyPressEvent(QKeyEvent *event) override;
//    void keyReleaseEvent(QKeyEvent* event) override;
    //定时功能
    void timerEvent(QTimerEvent *event) override;
private:
    QOpenGLShaderProgram *program;
    QOpenGLBuffer VBO;
    GLfloat translate, xRot, yRot, zRot;
    int m_key;
    QSet<int> setList[6];
    QSet<int> ans; //涉及到变换的Index集合
    QMatrix4x4 matrix[54];
    int m_anti = 1;
};

#endif // MYOPENGLWIDGET_H
